/**
  ******************************************************************************
  * @file    app_timer.c 
  * @author  Sherlock
  * @version V0.1
  * @date    08/2/2024
  * @brief   Display interface
  ******************************************************************************
  * @copy
  *
  * <h2><center>&copy; COPYRIGHT 2010 Feirui</center></h2>
  */ 



/**
  * @brief  INCLUDE FILES.
  */
#ifndef	APP_TIMER_GLOBALS
#define	APP_TIMER_GLOBALS
#include <includes.h>


/**
  * @brief  Timer01hz
  * @param  none
  * @return none.
  */
void App_Tmr_TIMER01HZCallback(OS_TMR *ptmr, void *p_arg)
{
    (void)p_arg;

    if (ptmr == App_Tmr_TIMER01HZ)
    {
        SetOSFlagsForNewInform(App_Flags_COMMON,OSCommFlags_Timing);
        SetOSFlagsForNewInform(App_Flags_RS485Handle,RS485HandleFlags_Timing);
    }
}

/**
  * @brief  Timer05hz
  * @param  none
  * @return none.
  */
void App_Tmr_TIMER05HZCallback(OS_TMR *ptmr, void *p_arg)
{
    (void)p_arg;

    if (ptmr == App_Tmr_TIMER05HZ)
    {

    }
}

/**
  * @brief  Timer10hz
  * @param  none
  * @return none.
  */
void App_Tmr_TIMER10HZCallback(OS_TMR *ptmr, void *p_arg)
{
    INT8U os_err;
    (void)p_arg;

    if (ptmr == App_Tmr_TIMER10HZ)
    {
        OSFlagPost(App_Flags_NETWORK, OSNETWORKFlags_Timing, OS_FLAG_SET, &os_err);
        OSFlagPost(App_Flags_NETWORK, OSNETWORKFlags_Timing, OS_FLAG_SET, &os_err);
        OSFlagPost(App_Flags_WORKFLOW,OSWORKFLOWFlags_SelfTiming10HZ,OS_FLAG_SET, &os_err);
        SetOSFlagsForNewInform(App_Flags_Alarm, OSACADFlags_TIMING);
    }
}
/**
  * @brief  Timer40hz
  * @param  none
  * @return none.
  */
void App_Tmr_TIMER40HZCallback(OS_TMR *ptmr, void *p_arg)
{
    (void)p_arg;
    INT8U os_err;
    
    if (ptmr == App_Tmr_TIMER40HZ)
    {
        SetOSFlagsForNewInform(App_Flags_RELAY,OSRelayFlags_UpdTiming);
        OSFlagPost(App_Flags_WORKFLOW,OSWORKFLOWFlags_SelfTiming40HZ,OS_FLAG_SET, &os_err);
    }
}

/**
  * @brief  Timer20hz
  * @param  none
  * @return none.
  */
void App_Tmr_TIMER20HZCallback(OS_TMR *ptmr, void *p_arg)
{
    INT8U os_err;
    (void)p_arg;

    if (ptmr == App_Tmr_TIMER20HZ)
    {
        OSFlagPost(App_Flags_PID, OSPIDFlags_Timing, OS_FLAG_SET, &os_err);
        OSFlagPost(App_Flags_NETWORK, OSNETWORKFlags_Scand, OS_FLAG_SET, &os_err);
        SetOSFlagsForNewInform(App_Flags_DSTIN,OSDSTINFlags_DSTINTIMING);
    }

}


/*$PAGE*/#endif	/*	APP_TIMER_GLOBALS	*/
